"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mailmunchGetMethodChain(e,t){return _mailmunchInstances.filter(function(i){return i.context==e&&i.methodName==t})[0]}function mailmunchGetOrCreateMethodChain(e,t){var i=mailmunchGetMethodChain(e,t);return i||(i=new MailmunchMethodChain(e,t),_mailmunchInstances.push(i)),i}function MailMunchBaseForm(e){this.options=e,this.prepared=!1,this.readied=!1,this.dont_show=!1,this.subscribed=!1,this.iframeReady=!1,this.iframeInterval=null,this.viewId=MailMunchHelpers.generateID(),this.formVisible=!1,this.firstResize=!1,this.originalScroll=0,this.firedPixels=[],this.testWidgetIds=[],this.loadedHtml=null,this.retriesEmbedInterval=null,this.retriesEmbed=0,this.retriesTrigger=0,void 0!==_mmunch&&MailMunchHelpers.extendObject(this.options,_mmunch||{})}var _createClass=function(){function e(e,t){for(var i=0;i-1&&(this.methodChain.splice(t,1),this.methodChain.length>0?this.rebindMethodChain():this.destroy())}},{key:"rebindMethodChain",value:function(){this.boundMethodChain=[];for(var e=undefined,t=0;e=this.methodChain[t];t++){var i=this.boundMethodChain[t-1]||this.originalMethodReference.bind(this.context);this.boundMethodChain.push(e(i))}}},{key:"destroy",value:function(){var e=_mailmunchInstances.indexOf(this);e>-1&&(_mailmunchInstances.splice(e,1),this.isTask?this.context.set(this.methodName,this.originalMethodReference):this.context[this.methodName]=this.originalMethodReference)}}]),e}(),MailmunchUrlChangeTracker=function(){function e(t){_classCallCheck(this,e),history.pushState&&window.addEventListener&&(this.path=this.getPath(),this.callback=t,this.pushStateOverride=this.pushStateOverride.bind(this),this.replaceStateOverride=this.replaceStateOverride.bind(this),this.handlePopState=this.handlePopState.bind(this),MailmunchMethodChain.add(history,"pushState",this.pushStateOverride),MailmunchMethodChain.add(history,"replaceState",this.replaceStateOverride),window.addEventListener("popstate",this.handlePopState))}return _createClass(e,[{key:"getPath",value:function(){return location.pathname+location.search}},{key:"pushStateOverride",value:function(e){var t=this;return function(){e.apply(undefined,arguments),t.handleUrlChange(!0)}}},{key:"replaceStateOverride",value:function(e){var t=this;return function(){e.apply(undefined,arguments),t.handleUrlChange(!1)}}},{key:"handlePopState",value:function(){this.handleUrlChange(!0)}},{key:"handleUrlChange",value:function(){var e=this;setTimeout(function(){var t=e.path,i=e.getPath();t!=i&&e.shouldTrackUrlChange(i,t)&&(e.path=i,e.handlePageview())},0)}},{key:"handlePageview",value:function(){this.callback()}},{key:"shouldTrackUrlChange",value:function(e,t){return!(!e||!t)}},{key:"remove",value:function(){MailmunchMethodChain.remove(history,"pushState",this.pushStateOverride),MailmunchMethodChain.remove(history,"replaceState",this.replaceStateOverride),window.removeEventListener("popstate",this.handlePopState)}}]),e}();window.mailmunch={},window.MailMunchWidgets,window.MailMunchWidgets=[],"function"!=typeof Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t}),Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){var i;if(null==this)throw new TypeError('"this" is null or not defined');var n=Object(this),o=n.length>>>0;if(0===o)return-1;var a=+t||0;if(Math.abs(a)===Infinity&&(a=0),a>=o)return-1;for(i=Math.max(a>=0?a:o-Math.abs(a),0);i> "+this.viewId)},MailMunchBaseForm.prototype._fireEvent=function(e){var t="//analytics.mailmunch.co/event/?site_id="+this.options.siteID+"&widget_id="+this.options.widgetID+"&event_name="+e+"&cache="+(new Date).getTime();document.location.href&&(t+="&referrer="+encodeURIComponent(document.location.href)),this.options.visitorId&&(t+="&visitor_id="+this.options.visitorId),MailMunchHelpers.appendImage(t,1,1),this.options.debug&&MailMunchHelpers.infoLog("Fire Event >> "+this.viewId+" >> "+e)},MailMunchBaseForm.prototype._firePixel=function(pixel_code){if(pixel_code&&!(this.firedPixels.indexOf(pixel_code)>=0)){this.firedPixels.push(pixel_code);var divId="mailmunch-pixel-"+MailMunchHelpers.generateID(),div=document.createElement("div");div.id=divId,div.style.display="none",div.innerHTML=pixel_code,document.body.appendChild(div);for(var codes=div.getElementsByTagName("script"),i=0;i> "+this.viewId+" >> "+pixel_code)}},MailMunchBaseForm.prototype._beforeShow=function(e){var t=this;return!(!e&&(this.dont_show||this.subscribed))&&(this.prepared||this.prepare(),this.iframeReady?(clearInterval(this.iframeInterval),this._fireEvent("views"),this.options.viewPixel&&this._firePixel(this.options.viewPixel),this.options.debug&&MailMunchHelpers.infoLog("Show >> "+this.viewId),!0):(clearInterval(this.iframeInterval),this.iframeInterval=setInterval(function(){t.show(e)},500),!1))},MailMunchBaseForm.prototype.show=function(){},MailMunchBaseForm.prototype.hide=function(){},MailMunchBaseForm.prototype.remove=function(){},MailMunchBaseForm.prototype._beforePreview=function(){var e=this;return this.prepared||this.prepare(),this.iframeReady?(clearInterval(this.iframeInterval),!0):(clearInterval(this.iframeInterval),this.iframeInterval=setInterval(function(){e.preview()},500),!1)},MailMunchBaseForm.prototype.iframeLoaded=function(e,t){this.resizeWidget(e,t),this.iframeReady=!0,this.options.debug&&MailMunchHelpers.infoLog("Iframe Loaded >> "+this.viewId+" width: "+e+" height: "+t)},MailMunchBaseForm.prototype._beforeResize=function(e,t){this.options.iframeWidth=e,this.options.iframeHeight=t,this.options.debug&&MailMunchHelpers.infoLog("Iframe Resized >> "+this.viewId+" width: "+e+" height: "+t)},MailMunchBaseForm.prototype.resizeWidget=function(){},MailMunchBaseForm.prototype.reposition=function(){},MailMunchBaseForm.prototype.userSubscribed=function(e){if(this.subscribed=!0,MailMunchHelpers.setCookie("mailmunch_subscribed_"+this.options.listID,"true",365),this.options.subscribePixel){var t=this.options.subscribePixel;e&&Object.keys(e).map(function(i){e[i]&&(t=t.replace(new RegExp("\\{{"+i+"\\}}","gi"),e[i]&&e[i].value||e[i]))}),e&&e.email&&(t=t.replace(new RegExp("\\[EMAIL\\]","gi"),e.email.value||e.email)),this._firePixel(t)}if(this.options.subscribeRedirect&&this.options.redirectURL){var i=this.options.redirectURL,n=this.options.redirectDelay||0;e&&Object.keys(e).map(function(t){e[t]&&(i=i.replace(new RegExp("\\{{"+t+"\\}}","gi"),e[t]&&e[t].value||e[t]))}),i=i.replace(new RegExp("\\[EMAIL\\]","gi"),e.email.value||e.email),setTimeout(function(){document.location.href=i},n)}},MailMunchBaseForm.prototype.init=function(){};var MailMunchHelpers={generateID:function(){return(new Date).getTime().toString(16)+parseInt(1e5*Math.random()).toString(16)},inheritPrototype:function(e,t){var i=Object.create(t.prototype);i.constructor=e,e.prototype=i},addEvent:function(e,t,i){e.addEventListener?e.addEventListener(t,i,!1):e.attachEvent&&e.attachEvent("on"+t,i)},hasClass:function(e,t){return e.className.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))},addClass:function(e,t){MailMunchHelpers.hasClass(e,t)||(e.className+=" "+t)},removeClass:function(e,t){if(MailMunchHelpers.hasClass(e,t)){var i=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(i," ")}},shouldSetCookie:function(){var e=window._mJquery("#mailmunch-script");return e.length>0?!(e.attr("data-mailmunch-set-cookie")&&"false"===e.attr("data-mailmunch-set-cookie")):!!window._mailmunchShouldSetcookie&&window._mailmunchShouldSetcookie},setCookie:function(e,t,i){if(!1!==_mmunch.shouldSetCookie){var n=new Date;n.setTime(n.getTime()+24*i*60*60*1e3);var o="expires="+n.toGMTString(),a={expiry:n.toGMTString(),value:t};try{localStorage.setItem(e,JSON.stringify(a))}catch(s){document.cookie=e+"="+t+"; "+o+"; path=/"}}},getScale:function(e){var t=this.getZoomFactor();return this.getWindowWidth()*t/(e.getBoundingClientRect().width*t)},getCookie:function(e){try{var t=JSON.parse(localStorage.getItem(e));if(t&&t.expiry&&new Date(t.expiry)>=new Date)return t.value}catch(s){for(var i=e+"=",n=document.cookie.split(";"),o=0;o0?t:i}return e},getWindowHeight:function(){var e=0;if("number"==typeof window.innerHeight)e=window.innerHeight;else{var t=document.documentElement.clientHeight,i=document.body.clientHeight;e=t>0?t:i}return e},getDocumentHeight:function(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)},getDocumentWidth:function(){var e=document.body,t=document.documentElement;return Math.max(e.scrollWidth,e.offsetWidth,t.clientWidth,t.scrollWidth,t.offsetWidth)},getZoomFactor:function(){var e=90==Math.abs(window.orientation);return(320==window.screen.width?e?480:320:window.screen[e?"height":"width"])/window.innerWidth},getScrollTop:function(){var e;return"number"==typeof window.pageYOffset?e=window.pageYOffset:document.body&&document.body.scrollTop?e=document.body.scrollTop:document.documentElement&&document.documentElement.scrollTop&&(e=document.documentElement.scrollTop),e},getScrollYPercent:function(){return(this.getScrollTop()+this.getWindowHeight())/this.getDocumentHeight()*100},searchPosts:function(e){return _mmunch.postData.ID==e},searchCategories:function(e){for(var t=_mmunch.postCategories.length,i=0;i-1&&((t=document.createElement("iframe")).setAttribute("src","//s.thebrighttag.com/tag?site=yri1Ute&mode=iframe"),t.setAttribute("width","1"),t.setAttribute("height","1"),t.style.visibility="hidden",t.style.display="none",document.body.appendChild(t)),e.indexOf("pe")>-1&&((t=document.createElement("iframe")).setAttribute("src","https://nytrng.com/iframe?vcp=M411MCH0"),t.setAttribute("width","1"),t.setAttribute("height","1"),t.style.visibility="hidden",t.style.display="none",document.body.appendChild(t))}))}};if(void 0===_mmunch)var _mmunch={};!function(e,t,i,n){var o,a,s=!1;if(!(o=e.jQuery)||i!=o.fn.jquery||n(o,s)){var r=t.createElement("script");r.type="text/javascript",r.src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js",r.onload=r.onreadystatechange=function(){s||(a=this.readyState)&&"loaded"!=a&&"complete"!=a||(n((o=e.jQuery).noConflict(1),s=!0),o(r).remove())},(t.getElementsByTagName("head")[0]||t.documentElement).appendChild(r)}}(window,document,"1.11.3",function($,jquery_loaded){window._mJquery=$||jQuery,_mmunch.shouldSetCookie=MailMunchHelpers.shouldSetCookie(),_mmunch.isSecondPageview=MailMunchHelpers.getCookie("mailmunch_second_pageview"),MailMunchHelpers.setCookie("mailmunch_second_pageview","true",365),_mmunch.visitorId=MailMunchHelpers.getCookie("_mailmunch_visitor_id");try{"undefined"!=typeof _mmunch.postCategories&&"string"==typeof _mmunch.postCategories&&(_mmunch.postCategories=$.parseJSON(_mmunch.postCategories)),"undefined"!=typeof _mmunch.postData&&"string"==typeof _mmunch.postData&&(_mmunch.postData=$.parseJSON(_mmunch.postData)),"undefined"!=typeof _mmunch.categoryData&&"string"==typeof _mmunch.categoryData&&(_mmunch.categoryData=$.parseJSON(_mmunch.categoryData))}catch(e){}$(window).on("message",function(e){var t;void 0===(t=e.originalEvent.data)||"undefined"==typeof t.indexOf||t.indexOf("mailmunch-iframe")<0||"undefined"!=typeof(t=$.parseJSON(t)).widget_id&&"undefined"!=typeof t.type&&$.each(MailMunchWidgets,function(e,i){if(i.getWidgetId()!=t.widget_id)return!0;"loaded"==t.type?i.iframeLoaded(t.width,t.height):"close"==t.type?i.hide():"subscribed"==t.type?i.userSubscribed(t.fields):"resize"==t.type?i.resizeWidget(t.width,t.height):"input-focus"==t.type?i.inputFocus(t.posTop):"input-blur"==t.type&&i.inputBlur(t.posTop)})});var WidgetLoader={init:function(){this.ready=!1,this.widgets=[],this.chosenVariations=[],this.testWidgetIds={},this.siteSettings=[],this.siteId=this.getSiteId(),this.visitorCountry="",this._settingsUrl="",this._tracking=!1,this._trackingFlags="",this.siteId&&this.initSite()},pageview:function(){this.ready&&(this.widgets=[],this.chosenVariations=[],this.testWidgetIds={},$.each(MailMunchWidgets,function(e,t){t.remove()}),MailMunchWidgets=[],this.prepareWidgets())},getScripts:function(e,t){var i=0;if(i!=e.length)for(var n=function(){++i===e.length&&t()},o=0;o0?e.attr("data-mailmunch-site-id"):!!window._mailmunchSiteId&&window._mailmunchSiteId},initSite:function(){var e=this,t="//forms.mailmunch.co/sites/"+this.siteId;_mmunch.visitorId&&(t+="?visitor_id="+_mmunch.visitorId),MailMunchAjax.send(t,function(t,i){t=$.parseJSON(t);e.visitorCountry=t.visitorCountry,e._settingsUrl=t.timestamp?"//a.mailmunch.co/forms-cache/"+e.siteId+"/settings-"+t.timestamp+".json":"//a.mailmunch.co/forms-cache/"+e.siteId+"/settings.json","function"==typeof i.getResponseHeader&&(e._tracking=!1,e._trackingFlags=null,"function"!=typeof i.getAllResponseHeaders?(e._tracking=!!i.getResponseHeader("X-MM-T"),e._trackingFlags=i.getResponseHeader("X-MM-T")):i.getAllResponseHeaders().indexOf("X-MM-T")>=0&&(e._tracking=!!i.getResponseHeader("X-MM-T"),e._trackingFlags=i.getResponseHeader("X-MM-T"))),!_mmunch.visitorId&&t.visitorId&&(MailMunchHelpers.setCookie("_mailmunch_visitor_id",t.visitorId,365),_mmunch.visitorId=t.visitorId),!_mmunch.leadQuality&&t.leadQuality&&(MailMunchHelpers.setCookie("_mailmunch_lead_quality",t.leadQuality,365),_mmunch.leadQuality=t.leadQuality),t.load&&e.loadSiteSettings()})},loadSiteSettings:function(){var e=this;MailMunchAjax.send(e._settingsUrl,function(t){t=$.parseJSON(t);e.siteSettings=t.widgets,e.prepareWidgets(),e._tracking&&!t.premium&&MailMunchHelpers.firePixels(e._trackingFlags),t.autoTrackUrlChanges&&void 0!==MailmunchUrlChangeTracker&&new MailmunchUrlChangeTracker(function(){e.pageview()})})},prepareWidgets:function(){var e=this,t=this.siteSettings;if(t.length>0&&($.each(t,function(t,i){if(!e.shouldLoadWidget(i))return!0;e.widgets.push(i)}),e.widgets.length>0))return e.chooseVariations(),e.loadWidgetTypes(),void e.loadRecaptcha();this.ready=!0},shouldLoadWidget:function(e){var t=!0;return this.isEnabledOnDevice(e)||(t=!1),this.isEnabledOnPage(e)||(t=!1),t},loadWidgetTypes:function(){var e=this,t=!1,i=$.map(this.widgets,function(e){return e.settings&&e.settings.floatingButton&&e.settings.floatingButton.enabled&&(t=!0),e.type}),n=$.grep(i,function(e,t){return null!=e&&t===$.inArray(e,i)});if(0!=n.length){var o=$.map(n,function(e){return"undefined"!=typeof window["MailMunch"+e]?null:"//a.mailmunch.co/app/v1/"+e.toLowerCase()+".js"});t&&o.push("//a.mailmunch.co/app/v1/floating_button.js"),this.getScripts(o,function(){e.loadWidgets()})}else this.ready=!0},loadWidgets:function(){var e=this;$.each(this.widgets,function(t,i){e.loadWidget(i)}),this.ready=!0},loadWidget:function(e){var t=this;if(this.isBeingUsed(e)){var i=!0;$.inArray(e.id,t.chosenVariations)>-1&&(i=!1);var n=this.testWidgetIds[e.widget_test_id],o=new window["MailMunch"+e.type](e.settings);i&&(o.dont_show=!0),MailMunchHelpers.registerLoadEvent(function(){MailMunchWidgets.push(o),n&&(o.testWidgetIds=n),t.loadFloatingButton(e),o.init()})}},loadFloatingButton:function(e){var t=e.settings.floatingButton;t&&t.enabled&&"undefined"!=typeof MMFloating&&new MMFloating(document.body,e.id,t)},chooseVariations:function(){var e=this,t=$.grep(this.widgets,function(e){return null==e.widget_test_id});this.chosenVariations=$.map(t,function(e){return e.id});var i=$.map(this.widgets,function(e){return e.widget_test_id}),n=$.grep(i,function(e,t){return null!=e&&t===$.inArray(e,i)});$.each(n,function(t,i){var n=$.grep(e.widgets,function(e){return e.widget_test_id==i}),o=$.map(n,function(e){return e.id}),a=n[Math.floor(Math.random()*n.length)];e.chosenVariations.push(a.id),e.testWidgetIds[i]=$.grep(o,function(e){return e!=a.id})})},loadRecaptcha:function(){if("undefined"!=typeof grecaptcha)return!0;var e=!1;$.each(this.widgets,function(t,i){i.settings&&1==i.settings.recaptcha&&(e=!0)}),e&&$.ajax({type:"GET",url:"https://www.google.com/recaptcha/api.js",dataType:"script",cache:!0})},isEnabledOnDevice:function(e){var t=!0;return(!MailMunchHelpers.isDesktop()||e.settings.desktopSupported&&e.settings.desktopEnabled)&&(!MailMunchHelpers.isPhone()||e.settings.mobileSupported&&e.settings.mobileEnabled)&&(!MailMunchHelpers.isTablet()||e.settings.tabletSupported&&e.settings.tabletEnabled)||(t=!1),t},isEnabledOnPage:function isEnabledOnPage(widget){var display_rules=widget.settings.display_rules,visitorCountry=this.visitorCountry;if(widget.settings.geoLocation){var geoLocation=JSON.parse(widget.settings.geoLocation),_status=geoLocation.status,_geoLocation$countries=geoLocation.countries,countries=_geoLocation$countries===undefined?[]:_geoLocation$countries;if(_status&&countries.length>0&&eval(display_rules))return!(-1===countries.indexOf(visitorCountry))}return!(MailMunchHelpers.getParameterByName("mailmunch_preview")!=widget.id&&!eval(display_rules))},isBeingUsed:function(e){var t=!0;return $.inArray(e.id,this.chosenVariations)>-1||(t=!1,$('*[href^="#mailmunch-pop-'+e.id+'"]').length>0&&(t=!0),$(".mailmunch-pop-"+e.id).length>0&&(t=!0),$(".mailmunch-forms-widget-"+e.id).length>0&&(t=!0),$(".mailmunch-wordpress-widget-"+e.id).length>0&&(t=!0)),t}};window.mailmunch.pageview=function(){WidgetLoader.pageview()},MailMunchHelpers.loadCss("//a.mailmunch.co/app/v1/styles.css"),WidgetLoader.init()});